package com.ruoyi.info.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.info.domain.SysGrade;
import com.ruoyi.info.mapper.SysGradeMapper;
import com.ruoyi.info.service.ISysGradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 年级信息Service业务层处理
 *
 * @author silencezheng
 * @date 2022-10-19
 */
@Service
public class SysGradeServiceImpl implements ISysGradeService
{
    @Autowired
    private SysGradeMapper sysGradeMapper;

    /**
     * 查询年级信息
     *
     * @param id 年级信息主键
     * @return 年级信息
     */
    @Override
    public SysGrade selectSysGradeById(Long id)
    {
        return sysGradeMapper.selectSysGradeById(id);
    }

    /**
     * 查询年级信息列表
     *
     * @param sysGrade 年级信息
     * @return 年级信息
     */
    @Override
    public List<SysGrade> selectSysGradeList(SysGrade sysGrade)
    {
        return sysGradeMapper.selectSysGradeList(sysGrade);
    }

    /**
     * 新增年级信息
     *
     * @param sysGrade 年级信息
     * @return 结果
     */
    @Override
    public int insertSysGrade(SysGrade sysGrade)
    {
        sysGrade.setCreateTime(DateUtils.getNowDate());
        return sysGradeMapper.insertSysGrade(sysGrade);
    }

    /**
     * 修改年级信息
     *
     * @param sysGrade 年级信息
     * @return 结果
     */
    @Override
    public int updateSysGrade(SysGrade sysGrade)
    {
        sysGrade.setUpdateTime(DateUtils.getNowDate());
        return sysGradeMapper.updateSysGrade(sysGrade);
    }

    /**
     * 批量删除年级信息
     *
     * @param ids 需要删除的年级信息主键
     * @return 结果
     */
    @Override
    public int deleteSysGradeByIds(Long[] ids)
    {
        return sysGradeMapper.deleteSysGradeByIds(ids);
    }

    /**
     * 删除年级信息信息
     *
     * @param id 年级信息主键
     * @return 结果
     */
    @Override
    public int deleteSysGradeById(Long id)
    {
        return sysGradeMapper.deleteSysGradeById(id);
    }
}
